Linux Unified Key Setup
   HOME

TheInfoList



OR:

The Linux Unified Key Setup (LUKS) is a disk encryption specification created by Clemens Fruhwirth in 2004 and was originally intended for Linux. While most disk encryption software implements different, incompatible, and undocumented formats, LUKS implements a platform-independent standard on-disk format for use in various tools. This not only facilitates compatibility and interoperability among different programs, but also assures that they all implement password management in a secure and documented manner.


Description

LUKS is used to encrypt a block device. The contents of the encrypted device are arbitrary, and therefore any filesystem can be encrypted, including
swap partition In computer operating systems, memory paging is a memory management scheme by which a computer stores and retrieves data from secondary storage for use in main memory. In this scheme, the operating system retrieves data from secondary stora ...
s. There is an unencrypted header at the beginning of an encrypted volume, which allows up to 8 (LUKS1) or 32 (LUKS2) encryption keys to be stored along with encryption parameters such as cipher type and key size. The presence of this header is a major difference between LUKS and plain dm-crypt, since the header allows multiple different passphrases to be used, with the ability to change and remove them with ease. However, if the header is lost or corrupted, the device will no longer be decryptable. Encryption is done with a multi-layer approach. First, the block device is encrypted using multiple ''master keys'', each of which is encrypted with an active ''user key'' in each keyslot. While keyslots often contain a passphrase, other kinds of keys include OpenPGP public keys or X.509 certificates. PGP public keys can be used in combination with an OpenPGP
smart card A smart card, chip card, or integrated circuit card (ICC or IC card) is a physical electronic authentication device, used to control access to a resource. It is typically a plastic credit card-sized card with an embedded integrated circuit (IC) c ...
which is inserted into the host. This layered scheme is known a
TKS1
There are two versions of LUKS, with LUKS2 having features such as resilience to header corruption, and using the Argon2 encryption algorithm by default, whereas LUKS1 uses
PBKDF2 In cryptography, PBKDF1 and PBKDF2 (Password-Based Key Derivation Function 1 and 2) are key derivation functions with a sliding computational cost, used to reduce vulnerabilities of brute-force attacks. PBKDF2 is part of RSA Laboratories' Pu ...
. Conversion between both versions of LUKS is possible in certain situations, but some features may not be available with LUKS1 such as Argon2. LUKS2 uses
JSON JSON (JavaScript Object Notation, pronounced ; also ) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other ser ...
as a metadata format. Available cryptographic algorithms depends on individual kernel support of the host. Libgcrypt can be used as a backend for hashing, which supports all of its algorithms. It is up to the operating system vendor to choose the default algorithm. LUKS1 makes use of an anti-forensics technique called AFsplitter, allowing for secure data erasure and protection.


Using LUKS with LVM

Logical Volume Management In computer storage, logical volume management or LVM provides a method of allocating space on mass-storage devices that is more flexible than conventional partitioning schemes to store volumes. In particular, a volume manager can concatenate, ...
can be used alongside LUKS. ; LVM on LUKS : When LVM is used on an unlocked LUKS container, all underlying partitions (which are LVM logical volumes) can be encrypted with a single key. This is akin to splitting a LUKS container into multiple partitions. The LVM structure is not visible until the disk is decrypted. ; LUKS on LVM : When LUKS is used to encrypt LVM logical volumes, an encrypted volume can span multiple devices. The underlying LVM volume group is visible without decrypting the encrypted volumes.


Full disk encryption

A common usage of LUKS is to provide full disk encryption, which involves encrypting the root partition of an operating system installation, which protects the operating system files from being tampered with or read by unauthorized parties. On a Linux system, the
boot partition The system partition and the boot partition (also known as the system volume and the boot volume) are computing terms for disk partitions of a hard disk drive or solid-state drive that must exist and be properly configured for a computer to o ...
(/boot) may be encrypted if the bootloader itself supports LUKS (e.g. GRUB). This is undertaken to prevent tampering of the
Linux kernel The Linux kernel is a free and open-source, monolithic, modular, multitasking, Unix-like operating system kernel. It was originally authored in 1991 by Linus Torvalds for his i386-based PC, and it was soon adopted as the kernel for the GNU ope ...
. However, the first stage bootloader or an EFI system partition cannot be encrypted (see Full disk encryption#The boot key problem). On mobile Linux systems, postmarketOS has develope
osk-sdl
to allow a full disk encrypted system to be unlocked using a touch screen.


Encrypted home directories

On systems running
systemd systemd is a software suite that provides an array of system components for Linux operating systems. Its main aim is to unify service configuration and behavior across Linux distributions; Its primary component is a "system and service manager ...
, the systemd-homed component can be used to encrypt individual home directories.


Operating system support

The reference implementation for LUKS operates on Linux and is based on an enhanced version of cryptsetup, using dm-crypt as the disk encryption backend. Under Microsoft Windows, LUKS-encrypted disks can be used via the Windows Subsystem for Linux. (Formerly, this was possible with LibreCrypt, which currently has fundamental security holes, and which succeeded FreeOTFE, formerly DoxBox.) DragonFly BSD supports LUKS.


Installer support

Several Linux distributions allow the root device to be encrypted upon OS installation. These installers include Calamares,
Ubiquity Ubiquity is a synonym for omnipresence, the property of being present everywhere. Ubiquity may also refer to: * Ubiquity (software), a simple graphical installer made for the Ubuntu operating system * Ubiquity (Firefox), an experimental extens ...
, Debian-Installer, and more.


On-disk format

LUKS headers are forward compatible; newer versions of LUKS should be able to read headers of previous versions.


LUKS1


LUKS2

LUKS2 devices begin with a binary header intended to allow recognition and fast detection by blkid, which also contains information such as checksums. All strings used in a LUKS2 header are null-terminated strings. Directly after the binary header comes the JSON area, containing the objects config (configuration), keyslots, digests, segments (describes encrypted areas on the disk), and tokens containing extra metadata. The binary format for regular luks2 keyslots are mostly similar to their predecessor, with the addition of different per-keyslot algorithms. Another type of key exists to allow redundancy in the case that a re-encryption process is interrupted.


Examples

Cryptsetup is the reference implementation of the LUKS frontend. To encrypt a device with the path /dev/sda1: # cryptsetup luksFormat /dev/sda1 To unlock an encrypted device, where name is the mapped device name: # cryptsetup luksOpen /dev/sda1 name


Re-encrypting

Re-encrypting a LUKS container can be done either with the cryptsetup tool itself, or with a legacy tool called cryptsetup-reencrypt. These tools can also be used to add encryption to an existing unencrypted filesystem, or remove encryption from a block device. Both methods have similar syntax: # cryptsetup reencrypt /dev/sda1 # cryptsetup-reencrypt /dev/sda1


See also

* Comparison of disk encryption software


References


External links

*
Frequently Asked Questions (FAQ)LibreCrypt: Implementation for WindowsLUKS1 SpecificationLUKS2 Specification
{{Cryptographic software Cryptographic software Disk encryption Linux security software de:Dm-crypt#Erweiterung mit LUKS